import http from '@/utils/http'

const BASE_URL = '/cakerun/orderDetail'

export interface OrderDetailResp {
  id: string
  businessTime: string
  addTime: string
  orderId: string
  discountAmount: string
  originalBizType: string
  depositAmount: string
  mtRefund: string
  deliverDiscountFee: string
  disputeOrderNo: string
  realPayed: string
  bizCost: string
  accountId: string
  groupBuyIncoming: string
  orderCreateTime: string
  traceSettleStatus: string
  dealStartTime: string
  voucherPackageId: string
  dataTime: string
  refund: string
  accountName: string
  partnerSelfDeliverFee: string
  dealId: string
  remark: string
  traceTypeShowName: string
  poiId: string
  poiCity: string
  poiName: string
  savingCardDeductAmount: string
  deliveryFee: string
  originalAmount: string
  due: string
  sharedAmount: string
  service: string
  createUserString: string
  updateUserString: string
  disabled: boolean
}
export interface OrderDetailDetailResp {
  id: string
  cakerunAccountId: string
  businessTime: string
  autoPay: string
  serviceFeeRebate: string
  addTime: string
  orderId: string
  discountAmount: string
  originalBizType: string
  governmentDiscountAmount: string
  disputeAppealBack: string
  accountHistoryId: string
  agentCommissionAmount: string
  traceSettleStatusWithPayDate: string
  publicBenefitFee: string
  traceId: string
  depositAmount: string
  mtRefund: string
  deliverDiscountFee: string
  disputeOrderNo: string
  period: string
  needInvoiceFlag: string
  realPayed: string
  bizCost: string
  accountId: string
  groupBuyIncoming: string
  orderCreateTime: string
  traceSettleStatus: string
  contractNumber: string
  governmentSupplementary: string
  dealStartTime: string
  governmentDeduction: string
  voucherPackageId: string
  customerName: string
  otherIncome: string
  externalReason: string
  tradeActionType: string
  traceType: string
  dataTime: string
  isGovernment: string
  differentCustomer: string
  refund: string
  safeEatFee: string
  commissionRate: string
  code: string
  bizType: string
  sequenceNoComment: string
  accountName: string
  partnerSelfDeliverFee: string
  dealId: string
  remark: string
  originalTraceTypeName: string
  governmentTotalDeduction: string
  deliverPerformanceId: string
  savingCardAmount: string
  disputeCompensation: string
  traceTypeShowName: string
  customerId: string
  contractName: string
  poiId: string
  poiCity: string
  accountInfo: string
  otherIncomeComment: string
  originalTraceType: string
  poiName: string
  dealName: string
  dealOffline: string
  governmentTotalSupplementary: string
  serviceFeeDiscount: string
  periodTips: string
  savingCardDeductAmount: string
  deliveryFee: string
  originalAmount: string
  due: string
  sharedAmount: string
  service: string
  contractId: string
  hasAgentCommissionAmount: string
  checkBillType: string
  jyeztgAdFee: string
  settleType: string
  payPlan: string
  createUserString: string
  updateUserString: string
}
export interface OrderDetailQuery {
  sort: Array<string>
}
export interface OrderDetailPageQuery extends OrderDetailQuery, PageQuery {}

/** @desc 查询订单明细列表 */
export function listOrderDetail(query: OrderDetailPageQuery) {
  return http.get<PageRes<OrderDetailResp[]>>(BASE_URL, query)
}

/** @desc 查询订单明细详情 */
export function getOrderDetail(id: string) {
  return http.get<OrderDetailDetailResp>(`${BASE_URL}/${id}`)
}

/** @desc 新增订单明细 */
export function addOrderDetail(data: any) {
  return http.post(BASE_URL, data)
}

/** @desc 修改订单明细 */
export function updateOrderDetail(data: any, id: string) {
  return http.put(`${BASE_URL}/${id}`, data)
}

/** @desc 删除订单明细 */
export function deleteOrderDetail(id: string) {
  return http.del(BASE_URL, { ids: [id] })
}

/** @desc 导出订单明细 */
export function exportOrderDetail(query: OrderDetailQuery) {
  return http.download(`${BASE_URL}/export`, query)
}
